#define _CRT_SECURE_NO_WARNINGS 1;
#include "list.h"


namespace wlc
{
	template <class T>
	void print(const list<T>& lt)
	{
		typename list<T>::const_iterator it = lt.begin();
		while (it != lt.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;
	}

	void list_test1()
	{
		list<int> lt;

		lt.push_back(1);
		lt.push_back(2);
		lt.push_back(3);
		lt.push_back(4);

		list<int>::iterator it = lt.begin();
		while (it != lt.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;

		print(lt);
	}

	struct Pos
	{
		int _row;
		int _col;

		Pos(int row = 0, int col = 0)
			:_row(row)
			,_col(col)
		{}
	};

	void list_test2()
	{
		list<Pos> lt1;
		lt1.push_back({1,2});
		lt1.push_back({3,4});
		lt1.push_back({5,6});
		lt1.push_back({7,8});

		list<Pos>::iterator it1 = lt1.end();
		++it1;
		lt1.insert(it1, { 3,3 });

		list<Pos>::iterator it = lt1.begin();
		//auto it = lt1.begin();
		while (it != lt1.end())
		{
			cout << it->_row << ":" << it->_col << endl;
			++it;
		}
		cout << endl;
	}

	void list_test3()
	{
		list<int> lt;
		lt.push_back(1);
		lt.push_back(2);
		lt.push_back(3);
		lt.push_back(4);

		print(lt);

		lt.push_front(0);
		lt.push_front(-1);
		lt.push_front(-2);

		print(lt);

		lt.pop_back();
		lt.pop_back();

		lt.pop_front();
		lt.pop_front();

		print(lt);

		list<int> lt1;
		lt1 = lt;
		print(lt1);

		cout << lt1.size() << endl;
	}
}

int main()
{
	//wlc::list_test1();
	//wlc::list_test2();
	wlc::list_test3();
	return 0;
}